import { reactive, onMounted } from 'vue'
import { listDataByType } from '@/core/api/dict/index.ts'

export function loadDict(enumType: Array<string>) {
  let dictList: any = reactive({})
  onMounted(async () => {
    if (enumType.length > 0) {
      for (const type of enumType) {
        const res: any = await listDataByType(type)
        if (res.data != null) {
          dictList[type] = res.data
        }
      }
    }
  })
  return { dictList }
}
